<template>
	<view>
		<view class="padding margin-xs bg-white radius" v-for="(item,index) in list.rows" :key="index">
			<view class="flex">
				<view class="flex-sub">
					<view class="">
						收款方式：{{item.accountType=='1'?'支付宝':'微信'}}
					</view>
					<view class="padding-top-xs">
						提现账号：{{item.account}}
					</view>
					<view class="padding-top-xs">
						提现金额：{{item.goldCoinNum}}
					</view>
				</view>
				<view class="flex-sub text-gray text-center padding-top">
					{{item.creTm}}
				</view>
			</view>
		</view>

		<view v-if="isLoad" class="cu-load text-gray loading"></view>
		<view v-else-if="list.rows.length < list.total" class="cu-load text-gray">已加载</view>
		<view v-else-if="list.rows.length==list.total && list.total!=0" class="cu-load text-gray over"></view>
		<view v-else="list.total==0" class="pos-center text-center text-gray">
			<text class="cuIcon-activityfill" style="font-size: 30px;"></text>
			<view class="">
				暂无数据
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				isLoad: false,
				list: [],
				queryData: {
					currPage: 1,
					creterID: ''
				},
			};
		},
		onLoad() {
			let u = uni.getStorageSync('ONLINE_USER');
			this.queryData.creterID = u.userID;
			this.getList();
		},
		// 下拉刷新
		onPullDownRefresh: function() {
			this.queryData.currPage = 1;
			let _this = this;
			setTimeout(function() {
				uni.stopPullDownRefresh();
				_this.getList();
			}, 1000);
		},
		// 上拉加载
		onReachBottom() {
			if(this.list.rows.length<this.list.total){
				this.queryData.currPage += 1;
				this.getList();
			}
		},
		methods: {
			getList() {
				this.isLoad = true;
				let _this = this;
				this.baseRequest('api/transfer/page', 'GET', this.queryData, function(res, info) {
					if (res) {
						if (_this.queryData.currPage != 1) {
							_this.list.rows = _this.list.rows.concat(res.rows);
							_this.list.total = res.total;
						} else {
							_this.list = res;
						}
					} else {
						_this.list = {
							total: 0,
							rows: []
						};
					}
					_this.isLoad = false;
				}, function(){
					_this.list = {
						total: 0,
						rows: []
					};
				});
			},
		}
	}
</script>
